---
layout: "default"
title: "Mirror.AncestorRepresentation"
description: "Swift documentation for 'Mirror.AncestorRepresentation': Representation of ancestor classes."
keywords: "Mirror.AncestorRepresentation,enum,swift,documentation"
root: "/v3.1"
---

<div class="intro-declaration"><code class="language-swift">enum Mirror.AncestorRepresentation</code></div>

<div class="discussion comment">
    <p>Representation of ancestor classes.</p>

<p>A <code>CustomReflectable</code> class can control how its mirror will
represent ancestor classes by initializing the mirror with a
<code>AncestorRepresentation</code>.  This setting has no effect on mirrors
reflecting value type instances.</p>
</div>

<table class="standard">



<tr>
<th>Import</th>
<td><code class="language-swift">import Swift</code></td>
</tr>

</table>

<h3 id="cases">Cases</h3>
<div class="declaration" id="case-generated">
<a class="toggle-link" data-toggle="collapse" href="#comment-case-generated">case generated</a>
<div class="comment collapse" id="comment-case-generated"><div class="p">
    <p>Generate a default mirror for all ancestor classes.</p>

<p>This case is the default.</p>

<p><strong>Note:</strong> This option generates default mirrors even for
  ancestor classes that may implement <code>CustomReflectable</code>&#39;s
  <code>customMirror</code> requirement.  To avoid dropping an ancestor class
  customization, an override of <code>customMirror</code> should pass
  <code>ancestorRepresentation: .Customized(super.customMirror)</code> when
  initializing its <code>Mirror</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift"></code>
</div></div>
</div>
<div class="declaration" id="case-customized">
<a class="toggle-link" data-toggle="collapse" href="#comment-case-customized">case customized(() -> Mirror)</a>
<div class="comment collapse" id="comment-case-customized"><div class="p">
    <p>Use the nearest ancestor&#39;s implementation of <code>customMirror</code> to
create a mirror for that ancestor.  Other classes derived from
such an ancestor are given a default mirror.</p>

<p>The payload for this option should always be
&quot;<code>{ super.customMirror }</code>&quot;:</p>

<pre><code class="language-swift">var customMirror: Mirror {
  return Mirror(
    self,
    children: [&quot;someProperty&quot;: self.someProperty],
    ancestorRepresentation: .Customized({ super.customMirror })) // &lt;==
}</code></pre>

    <h4>Declaration</h4>    
    <code class="language-swift"></code>
</div></div>
</div>
<div class="declaration" id="case-suppressed">
<a class="toggle-link" data-toggle="collapse" href="#comment-case-suppressed">case suppressed</a>
<div class="comment collapse" id="comment-case-suppressed"><div class="p">
    <p>Suppress the representation of all ancestor classes.  The
resulting <code>Mirror</code>&#39;s <code>superclassMirror</code> is <code>nil</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift"></code>
</div></div>
</div>








